<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        if ($_COOKIE['username'] == NULL) {
            $this->error('请登录','/bookManage/home/user/login',1);
        }
    	$username = cookie('username');
    	$booklist = D('borrow')->where("pname='".$username."'")->select();
    	foreach ($booklist as $k => $v) {
    		$v['yinggui'] = $v['addtime'] + $v['day'] * 86400;
    		$booklist[$k] = $v;
    	}
    	$this->assign('booklist',$booklist);
        $this->display();
    }
}